package com.iflytek.cuckoo.dao;

import com.iflytek.cuckoo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * <p><一句话功能简述>
 * <p><功能详细描述>
 * <p>
 * <p>Copyright (c) 2018, liangzhang14@iflytek.com All Rights Reserve</p>
 * <p>Company : 科大讯飞</p>
 *
 * @author liangzhang14
 * @version [V1.0, 2019年01月29日 15:46]
 * @see [相关类/方法]
 */
public interface UserRepository extends JpaRepository<User,Long> {

    User findByName(String name);

    User findUserById(Long id);

    List<User> findByNameContains(String searchKey);

    @Query(value=" select * from user where name = ?1 and email = ?2 ",nativeQuery=true)
    List<User> findByAppNameAndEmail(String appName, String projectId);
}
